package com.usian.service.impl;

import com.usian.mapper.StudentMapper;
import com.usian.pojo.Student;
import com.usian.service.StudentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {



    @Autowired
    private StudentMapper studentMapper;

    private final static Logger logger = LoggerFactory.getLogger(StudentServiceImpl.class);

    @Override
    public List<Student> findAll() {
        return studentMapper.selectList(null);
    }

    @Override
    public void addStu(Student student) {
        logger.debug("============用户保存成功Service");
        studentMapper.insert(student);
    }

    @Override
    public void delStu(Integer id) {
        studentMapper.deleteById(id);
    }

    @Override
    public Student findById(Integer id) {
        return studentMapper.selectById(id);
    }

    @Override
    public void updateStu(Student student) {
        studentMapper.updateById(student);
    }

    @Override
    public void testCorn() {
        logger.info("service  Add  User>>>>>>>>>>>>");
    }

}
